<!--河南星辰软件科技有限公司
@copyright Copyright (c) 2010~2022 All rights reserved.
-->
<template>
  <div class='app-container'>
    <el-row>
      <el-col :span='22' :xs='24'>
        <table cellpadding="0" cellspacing="0" border="0" width="100%">
          <tr>
            <td nowrap class="containerSubtabLabel"></td>
            <td width="100%" class="containerSubtabSpace">&nbsp;</td>
          </tr>
        </table>
        <table cellpadding="0" cellspacing="0" border="0" class="conSubs">
          <tr>
            <td class="conSubOff" nowrap><a href="gotoPage('')">42DDD808089C44309487514A2E9E30C2</a></td>
          </tr>
          <tr>
          </tr>
        </table>
        <el-form ref="form" :model="steps" :rules="rules" label-width="100px" id="mvcfm">
          <el-button @click="gotoPage('592DAF0978E84436ACBA82C1D28FA929?'+vueparams+'')" type='primary' size="mini">设置工时</el-button>
          <el-button @click="gotoPage('/mes/produce/flow/TimeSet?'+vueparams+'')" type='primary' size="mini">设置时间</el-button>
          <div class="form-unit">
            <span class="mvc-title-left"> 流程明细 </span>
          </div>
          <el-table :data="steps">
            <el-table-column label="操作" align="center" width='100' type=''>
              <template slot-scope="scope">
                <el-dropdown trigger="click">
                  <span class="el-dropdown-link">操作<i class="el-icon-arrow-down el-icon--right"></i></span>
                  <el-dropdown-menu slot="dropdown">
                    <el-dropdown-item>
                    </el-dropdown-item>
                    <el-dropdown-item>
                      <el-link @click="gotoPage('&CMID1='+scope.row.item_work_id+''+vueparams+'')">删除</el-link>
                    </el-dropdown-item>
                    <el-dropdown-item>
                    </el-dropdown-item>
                    <el-dropdown-item>
                    </el-dropdown-item>
                    <el-dropdown-item>
                    </el-dropdown-item>
                  </el-dropdown-menu>
                </el-dropdown>
              </template>
            </el-table-column>
            <el-table-column label="步骤" prop="workName">
            </el-table-column>
            <el-table-column label="采购" prop="workName">
            </el-table-column>
            <el-table-column label="指定用户" prop="owner">
            </el-table-column>
            <el-table-column label="任务" prop="openURL">
              <template slot-scope="scope">
              </template>
            </el-table-column>
            <el-table-column label="状态" prop="item_work_id">
              <template slot-scope="scope">
                <el-link @click="popStepStatus('&CMSTEPWORKID='+scope.row.item_work_id+'')" type='primary'>{{scope.row.status}}</el-link>
              </template>
            </el-table-column>
            <el-table-column label="子流程" prop="item_work_id">
              <template slot-scope="scope">
                <el-link @click="gotoPage('0247F7BD9AAD471097FC75187D03B1DB?&CMSTEPWORKID='+scope.row.item_work_id+''+vueparams+'')" type='primary'>{{emt['step_subflow_cnt']}}个</el-link>
              </template>
            </el-table-column>
            <el-table-column label="开始时间" prop="start_time">
              <template slot-scope="scope">
                {{getDateTimeString(scope.row,'start_time')}}
              </template>
            </el-table-column>
            <el-table-column label="结束时间" prop="end_time">
              <template slot-scope="scope">
                {{getDateTimeString(scope.row,'end_time')}}
              </template>
            </el-table-column>
            <el-table-column label="开始工时" prop="start_inttime">
            </el-table-column>
            <el-table-column label="结束工时" prop="end_inttime">
            </el-table-column>
          </el-table>
          <div class="form-unit">
            <span class="mvc-title-left"> 采购明细 </span>
          </div>
          <el-table :data="purchases">
            <el-table-column label="采购" prop="workName">
            </el-table-column>
            <el-table-column label="开始时间" prop="start_time">
            </el-table-column>
            <el-table-column label="结束时间" prop="end_time">
            </el-table-column>
            <el-table-column label="开始工时" prop="start_inttime">
            </el-table-column>
            <el-table-column label="结束工时" prop="end_inttime">
            </el-table-column>
          </el-table>
        </el-form>
        <el-menu-item v-for='item in Container1'>
          <el-link @click="gotoMenu(item.url)" :type="'生产作业'===item.name?'primary':'default'">{{item.page_desc||item.name}}</el-link>
        </el-menu-item>
      </el-col>
      <el-col :span='2' :xs='24'>
        <el-menu default-active='active' class='menu-unit'>
          <el-menu-item v-for='item in Container'>
            <el-link @click="gotoMenu(item.url)" :type="'工序流程'===item.name?'primary':'default'">{{item.page_desc||item.name}}</el-link>
          </el-menu-item>
        </el-menu>
      </el-col>
    </el-row>
    <el-dialog :visible.sync="StepStatusVisible" append-to-body>
      <StepStatus v-if="StepStatusVisible" ref="StepStatus" :popparams="popparams"> </StepStatus>
    </el-dialog>
  </div>
</template>
<script>
  import request from '@/utils/request'
  import StepStatus from "@/views/mes/main/StepStatus";
  export default {
    name: 'ProduceOperator',
    components: {
      StepStatus,
    },
    props: ['popparams'],
    data() {
      return {
        StepStatusVisible: false,
        StepStatusValue: null,
        StepStatusDesc: null,
        vueparams: this.getVUEParams(""),
        steps: [],
        purchases: [],
        s_flow: [],
        loading: false,
        Container: null,
        Container1: null,
        rules: {}
      }
    },
    created() {
      this.getData();
      this.loadContainerMenu({
        pid: "42DDD808089C44309487514A2E9E30C2",
        name: "工序编辑器右菜单",
        selected: "工序流程"
      }, 'Container', this.vueparams);
      this.loadContainerMenu({
        pid: "42DDD808089C44309487514A2E9E30C2",
        name: "工序流程菜单",
        selected: "生产作业"
      }, 'Container1', this.vueparams);
    },
    updated() {},
    mounted() {},
    methods: {
      getData() {
        request({
          method: 'get',
          url: '/xcapi/VUEAction/mes/main/ProduceTraceability/produceOperator?' + this.vueparams,
        }).then(data => {
          for (var k in data) {
            if (Array.isArray(data[k])) {
              this[k] = data[k];
            } else {
              $.extend(this[k], data[k]);
            }
          }
        })
      },
      list_s_flow(value) {
        if (this.$route.fullPath.indexOf("?") == -1) {
          this.$router.replace("/redirect" + this.$route.fullPath + "?CMFLOWWORKID=" + value);
        } else if (this.$route.fullPath.indexOf("CMFLOWWORKID=") == -1) {
          this.$router.replace("/redirect" + this.$route.fullPath + "&CMFLOWWORKID=" + value);
        } else {
          this.gotoPage("/redirect/mes/main/ProduceOperator?" + this.vueparams, {
            CMFLOWWORKID: value
          });
        }
      },
      popStepStatus(params) {
        if (params != "") this.popparams = params + this.vueparams;
        this.StepStatusVisible = !this.StepStatusVisible;
      },
    },
  }
</script>
